#include <iostream>
#include <cstring>
#include <memory>

using namespace std;

int main()
{
	// 智能指针初始化
	std::shared_ptr<int> p1(new int(1));
	std::shared_ptr<int> p2 = p1;
	cout << "p2 =" << p2.use_count() << endl;
	cout << "p1 =" << p1.use_count() << endl;
	
	std::shared_ptr<int> p3;
	p3.reset(new int(1));
	if (p3)
	{
		cout << "p3 is not null =" << *p2 << endl;
	}

	// 
	shared_ptr<int> sp1(new int(100));
	cout << "sp1 =" << *sp1 << endl;

	return 0;
}